package com.threadExample;

/**
 * Created by yijy on 2017/7/26.
 */
public class Consumer extends Thread {
    private Stack theStack;

    public Consumer(Stack theStack,String name) {
        super(name);
        this.theStack = theStack;
        start();
    }

    @Override
    public void run() {
        super.run();
        String goods;
        for (int i=0;i<200;i++){
            goods = "goods"+(theStack.getPoint()-1);
            theStack.pull();
            System.out.println(getName()+":pull "+ goods +" to "+theStack.getName());
        }
    }
}
